﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ProtocolConversion_WINCE
{
    /// <summary>
    /// watch dog
    /// </summary>
    class WDT
    {
        [DllImport("HDI_API.dll")]
        public static extern bool API_WDT_SetTimeOut(byte wdtime);
        [DllImport("HDI_API.dll")]
        public static extern bool API_WDT_Enable();
        [DllImport("HDI_API.dll")]
        public static extern bool API_WDT_Disable();
        [DllImport ("HDI_API.dll")]
        public static extern bool API_WDT_Feed();
        [DllImport("HDI_API.dll")]
        public static extern bool API_HW_Reboot();

        public static void StartWDT()
        {
            API_WDT_SetTimeOut(60);
            API_WDT_Enable();
        }

        public static void StopWDT()
        {
            API_WDT_Disable();
        }
        public static void FeedWDT()
        {
            API_WDT_Feed();
        }
        public static void ReBootSystem()
        {
            //API_WDT_Disable();
            //API_WDT_SetTimeOut(1);
            //API_WDT_Enable();
            API_HW_Reboot();
        }
    }
}
